﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace PCLawPrototype
{
    public partial class ManageInvoice : ManageRibbonForm
    {
        public ManageInvoice()
        {
            InitializeComponent();
        }

        private void ManageInvoice_FormClosing(object sender, FormClosingEventArgs e)
        {
            this.Hide();
            e.Cancel = true;
            ((DStarter)this.MdiParent).SetRPEventVisible(false);
        }

        public override void Add()
        {
            NewInvoice newInvoice = new NewInvoice();
            newInvoice.ShowDialog();
        }
        public override void Edit()
        {
            NewInvoice newInvoice = new NewInvoice(true);
            newInvoice.ShowDialog();
        }
        public override void Delete()
        {
            if (lstClient.SelectedIndices.Count > 0)
                lstClient.Items.RemoveAt(lstClient.SelectedIndices[0]);
        }
        public override void Reload()
        {
            MessageBox.Show("Reload data from database and fill data to list!", "Description for function", MessageBoxButtons.OK, MessageBoxIcon.Information);
        }
        public override void Active()
        {
            
        }

        public override void StartSearch()
        {
            MessageBox.Show("Data Filtered!");
        }

        public override void MakeAPayment()
        {
            MessageBox.Show("Data is saved!");
        }

        private void ManageInvoice_Activated(object sender, EventArgs e)
        {
            ((DStarter)this.MdiParent).SetActiveVisible(false);
            ((DStarter)this.MdiParent).SetRPGInvoiceVisible(true);
            ((DStarter)this.MdiParent).SetEventFocus();
        }

        private void ManageInvoice_Deactivate(object sender, EventArgs e)
        {
            ((DStarter)this.MdiParent).SetActiveVisible(true);
            ((DStarter)this.MdiParent).SetRPGInvoiceVisible(false);
        }

        private void lstClient_DoubleClick(object sender, EventArgs e)
        {
            NewInvoice newInvoice = new NewInvoice(true);
            newInvoice.ShowDialog();
        }

        private void lstClient_Click(object sender, EventArgs e)
        {
            ((DStarter)this.MdiParent).SetEventFocus();
        }

    }
}
